<template>
	<view>
		<view class="noteContainer" v-for="(item, index) in noteList" :key="index">
			<view class="header">
				<image class="left" :src="item.cover" mode="scaleToFill"></image>
				<view class="middle">
					<view class="title text-2line-ellipsis">
						{{item.title}}
					</view>
					<view class="detail text-2line-ellipsis">
						{{item.briefly}}
					</view>

				</view>

				<sendTiktok
					:id="item.id"
					:contentType="'note'"
					:title="item.title"
					>				
				</sendTiktok>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations,
		mapActions
	} from 'vuex';
	let that = null
	const api = require("@/static/js/api.js")
	const utils = require("@/static/js/utils.js")
	import sendTiktok from "./sendTiktok.vue"
	export default {
		computed: {
			...mapState({
				hasLogin: state => state.userInfo.hasLogin,
				isAuthUserInfo: state => state.userInfo.isAuthUserInfo,
				isAuthPhone: state => state.userInfo.isAuthPhone,
				isShopEmployee: state => state.userInfo.isShopEmployee,
				avatarUrl: state => state.userInfo.avatarUrl,
				nickName: state => state.userInfo.nickName,
				telephone: state => state.userInfo.telephone,
				openId: state => state.userInfo.openId,
				employeeId: state => state.userInfo.employeeId,
				shopEmployee: state => state.userInfo.shopEmployee,
				currentShop: state => state.userInfo.currentShop,
				memberShop: state => state.userInfo.memberShop,
				isSeller: state => state.userInfo.isSeller,
				sellerObj: state => state.userInfo.sellerObj,
				buyerId: state => state.userInfo.buyerObj.id,
			}),
		},
		components: {
			sendTiktok
		},
		data() {
			return {

				noteList: [],
			};
		},
		created() {
			let that = this
			api.getNoteList({
				param: {
					limit: 100,
					page: 0,
				}
			}).then(res => {
				console.log(res)
				if (res.code == 0) {
					that.noteList = res.data
				}
			})
		},



		methods: {
			...mapMutations(['setUserInfo', 'setLoginStatus', 'setUserId', "setOrigin"]),

		}
	}
</script>

<style lang="scss">
	.noteContainer {
		width: 100%;
		background: #FFFFFF;
		box-shadow: 2rpx 2rpx 8rpx 4rpx #EEEEEE;
		border-radius: 20rpx;
		margin-top: 30rpx;
		margin-bottom: 30rpx;
		box-sizing: border-box;

		.header {
			width: 100%;
			display: flex;
			justify-content: space-between;
			padding: 20rpx;
			align-items: center;

			.left {
				width: 184rpx;
				height: 138rpx;
				border-radius: 20rpx;
				background-color: #f6f6f6;
				margin-right: 20rpx;
				display: flex;
			}

			.middle {
				width: 350rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.title {
					width: 100%;
					font-size: 30rpx;
					color: #515151;
					line-height: 42rpx;
					font-weight: bold;
					margin-bottom: 10rpx;
				}

				.detail {
					width: 100%;
					font-size: 20rpx;
					line-height: 25rpx;
					color: rgba(25, 25, 25, 0.5);
					min-height: 50rpx;
					margin-bottom: 20rpx;
				}

				.dataWrapper {
					display: flex;
					width: 100%;
					justify-content: space-between;
					align-items: center;
					color: rgba(60, 60, 60, 0.5);
					font-size: 20rpx;
					margin-bottom: 15rpx;

					.pageViews {
						display: flex;
						align-items: center;

						.iconWrapper {
							width: 28rpx;
							height: 16rpx;
							margin-right: 10rpx;
						}
					}

					.timeWrapper {
						display: flex;
						align-items: center;

						.iconWrapper {
							width: 19rpx;
							height: 18rpx;
							margin-right: 10rpx;
						}
					}
				}
			}


			.right {
				height: 50rpx;
				width: 140rpx;
				border-radius: 30rpx;
				background-color: #007aff;
				color: #ffffff;
				font-size: 22rpx;
				text-align: center;
				line-height: 50rpx;
			}
		}
	}
</style>